import java.util.ArrayList;
import java.util.List;

public class ObserverPattern {
    public static void main(String[] args) {
        Child child = new Child();
        child.wakeup();
    }
}

class Child {
    List<Observer> observers = new ArrayList<Observer>();

    public Child() {
        observers.add(new Dad());
        observers.add(new Mum());
    }

    void wakeup() {
        for (Observer observer : observers) {
            observer.wakeup();
        }
    }
}

abstract class Observer {
    abstract void wakeup();
}

class Dad extends Observer {
    void wakeup() {
        System.out.println("feed");
    }
}

class Mum extends Observer {
    void wakeup() {
        System.out.println("hug");
    }
}
